local skel = fk.CreateSkill {
  name = "emo__zhuojian",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__zhuojian"] = "灼见",
  [":emo__zhuojian"] = "锁定技，每当你使用牌后，从牌堆中随机获得一张点数相同的牌，若未获得，本回合此技能失效。",

  ["$EmoZhuoJianFail"] = "牌堆中未发现 %arg 点牌！",
}

skel:addEffect(fk.CardUseFinished, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(skel.name) and data.card.number > 0 and data.card.number < 14 then
      return true
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = table.filter(room.draw_pile, function (id)
      return Fk:getCardById(id).number == data.card.number
    end)
    if #cards > 0 then
      room:moveCardTo(table.random(cards), Player.Hand, player, fk.ReasonPrey, skel.name)
    else
      room:sendLog{ type = "$EmoZhuoJianFail", arg = tostring(data.card.number) }
      room:invalidateSkill(player, skel.name, "-turn")
    end
  end,
})


return skel
